🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / feature / car / src / main / kotlin / org / meshtastic / feature / car / util / PersonIconFactory.kt
Displaying Raw • Download
feature/car/src/main/kotlin/org/meshtastic/feature/car/util/PersonIconFactory.kt a048ea1c940840b85d6ab6d704f72e02566d120a (a048ea1c) Text, 2.15 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.car.util
Tff7b72import T7ee787android.graphics.Canvas
Tff7b72import T7ee787android.graphics.Paint
Tff7b72import T7ee787androidx.core.graphics.createBitmap
Tff7b72import T7ee787androidx.core.graphics.drawable.IconCompat
T8b949e/**
* Renders a circular avatar with a single uppercase initial — used for [androidx.core.app.Person] icons in
* MessagingStyle notifications and for conversation shortcut avatars.
*/
Tff7b72internal Tff7b72object T56d364PersonIconFactory Tb4b4b4{
Tff7b72private Tff7b72const Tff7b72val Te6edf3ICON_SIZE Tff7b72= T79c0ff1T79c0ff2T79c0ff8
Tff7b72private Tff7b72const Tff7b72val Te6edf3TEXT_SIZE_RATIO Tff7b72= T79c0ff0.5f
Tff7b72fun Td2a8ffcreateTb4b4b4(Te6edf3nameTb4b4b4: Tffa657StringTb4b4b4, Te6edf3backgroundColorTb4b4b4: Tffa657IntTb4b4b4, Te6edf3foregroundColorTb4b4b4: Tffa657IntTb4b4b4)Tb4b4b4: Te6edf3IconCompat Tb4b4b4{
Tff7b72val Te6edf3bitmap Tff7b72= Te6edf3createBitmapTb4b4b4(Te6edf3ICON_SIZETb4b4b4, Te6edf3ICON_SIZETb4b4b4)
Tff7b72val Te6edf3canvas Tff7b72= Te6edf3CanvasTb4b4b4(Te6edf3bitmapTb4b4b4)
Tff7b72val Te6edf3paint Tff7b72= Te6edf3PaintTb4b4b4(Te6edf3PaintTb4b4b4.Te6edf3ANTI_ALIAS_FLAGTb4b4b4)
Te6edf3paintTb4b4b4.Te6edf3color Tff7b72= Te6edf3backgroundColor
Te6edf3canvasTb4b4b4.Te6edf3drawCircleTb4b4b4(Te6edf3ICON_SIZE Tff7b72/ T79c0ff2fTb4b4b4, Te6edf3ICON_SIZE Tff7b72/ T79c0ff2fTb4b4b4, Te6edf3ICON_SIZE Tff7b72/ T79c0ff2fTb4b4b4, Te6edf3paintTb4b4b4)
Te6edf3paintTb4b4b4.Te6edf3color Tff7b72= Te6edf3foregroundColor
Te6edf3paintTb4b4b4.Te6edf3textSize Tff7b72= Te6edf3ICON_SIZE Tff7b72* Te6edf3TEXT_SIZE_RATIO
Te6edf3paintTb4b4b4.Te6edf3textAlign Tff7b72= Te6edf3PaintTb4b4b4.Te6edf3AlignTb4b4b4.Te6edf3CENTER
Tff7b72val Te6edf3initial Tff7b72=
Tff7b72if Tb4b4b4(Te6edf3nameTb4b4b4.Te6edf3isNotEmptyTb4b4b4(Tb4b4b4)Tb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3codePoint Tff7b72= Te6edf3nameTb4b4b4.Te6edf3codePointAtTb4b4b4(T79c0ff0Tb4b4b4)
Tffa657StringTb4b4b4(Te6edf3CharacterTb4b4b4.Te6edf3toCharsTb4b4b4(Te6edf3codePointTb4b4b4)Tb4b4b4)Tb4b4b4.Te6edf3uppercaseTb4b4b4(Tb4b4b4)
Tb4b4b4} Tff7b72else Tb4b4b4{
Ta5d6ff"Ta5d6ff?Ta5d6ff"
Tb4b4b4}
Tff7b72val Te6edf3xPos Tff7b72= Te6edf3canvasTb4b4b4.Te6edf3width Tff7b72/ T79c0ff2f
Tff7b72val Te6edf3yPos Tff7b72= Te6edf3canvasTb4b4b4.Te6edf3height Tff7b72/ T79c0ff2f Tff7b72- Tb4b4b4(Te6edf3paintTb4b4b4.Te6edf3descentTb4b4b4(Tb4b4b4) Tff7b72+ Te6edf3paintTb4b4b4.Te6edf3ascentTb4b4b4(Tb4b4b4)Tb4b4b4) Tff7b72/ T79c0ff2f
Te6edf3canvasTb4b4b4.Te6edf3drawTextTb4b4b4(Te6edf3initialTb4b4b4, Te6edf3xPosTb4b4b4, Te6edf3yPosTb4b4b4, Te6edf3paintTb4b4b4)
Tff7b72return Te6edf3IconCompatTb4b4b4.Te6edf3createWithBitmapTb4b4b4(Te6edf3bitmapTb4b4b4)
Tb4b4b4}
Tb4b4b4}
Served by rngit 1.5.2 - Generated in 0.05s